package cn.lsj.openapi;

import cn.lsj.core.entity.Configuration;
import cn.lsj.core.Executor;

import java.util.List;

/**
 * @className: SqlSessionImpl
 * @description: TODO 类描述
 * @author: liangshijie
 * @date: 2023/3/11
 **/
public class SqlSessionImpl implements SqlSession {
    //每次Sql会话连接，必须要有数据库配置信息
    private Configuration configuration;

    public SqlSessionImpl(Configuration configuration) {
        this.configuration = configuration;
    }

    public <T> List<T> selectList(String statement) throws Exception {
        Executor executor = new Executor(configuration);
        return (List<T>) executor.executeQuery(statement);
    }
}
